package com.Domain;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import com.Data.DataLoader;
import com.EdificacioAR.DebugLog;
import com.Utils3D.GenericModelLoader;
import com.Utils3D.Model3D;

/**
 *
 * @author faust
 */
@Root (name="Model")
public class Model {

	@Element (name="name")
    private String name;
	@Element (name="filename")
    private String filename;
	
	private float scaleFactor;
	private float translateX, translateY;
	private Model3D modelData;

    public Model() {
        name = "";
        filename = "/";
        scaleFactor = 1.0f;
    }

    public Model(@Element (name="name") String name, @Element (name="filename") String path) {
        this.name = name;
        this.filename = path;
        scaleFactor = 1.0f;
        DebugLog.LOGD("Channel constructor: filename: " + filename);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return filename;
    }

    public void setPath(String path) {
        this.filename = path;
    }
    
    /*public float getScaleFactor() {
		return scaleFactor;
	}

	public void setScaleFactor(float scaleFactor) {
		this.scaleFactor = scaleFactor;
	}
	
	public float getTranslateX() {
		return this.translateX;
	}
	
	public float getTranslateY() {
		return this.translateY;
	}
	
	public void setTranslate(float incX, float incY) {
		this.translateX = incX;
		this.translateY = incY;
	}*/

	public Model3D getModelData() {
    	return this.modelData;
    }
    
    /** Read the model file stored in 'filename'*/
    public void load() {
    	this.modelData = GenericModelLoader.loadModel(
    			DataLoader.getAppDirectory() + "/" + filename);
    }

    @Override public String toString() {
    	String NEW_LINE = System.getProperty("line.separator");
        return "[ " + name + " - " + filename + " ]" + NEW_LINE;
    }

}
